package com.tbs.easyhomemoneyserver.utils

import cn.hutool.core.bean.BeanUtil
import java.util.*

object DtoUtils {
    fun <T, R> convert(obj: T, rclass: Class<out R>?): R {
        return BeanUtil.toBean(obj, rclass)
    }

    fun <T, R> convertAll(obj: List<T>, rclass: Class<out R>?): List<R> {
        var arr: MutableList<R> = LinkedList()
        for (o in obj) {
            arr.add(BeanUtil.toBean(o, rclass))
        }
        return arr
    }
}
